<template>
  <div>
    <ul class="mui-table-view">
      <li class="mui-table-view-cell mui-media" v-for="v in newsList" :key="v.id">
        <router-link :to="`/home/newsinfo/${v.id}`">
          <img class="mui-media-object mui-pull-left" src="../../images/menu1.png" />
          <div class="mui-media-body">
            <h3>{{ v.title }}</h3>
            <p class="mui-ellipsis">
              <span>发表时间: {{ v.add_time | dateFormat }}</span>
              <span>点击: {{ v.click }}次</span>
            </p>
          </div>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  created() {
    this.getNewsList()
  },
  data() {
    return {
      newsList: [],
    }
  },
  methods: {
    // 一、获取新闻列表
    async getNewsList() {
      const { data } = await this.$http.get("/api/getnewslist")
      // console.log(data)
      if (data.status === 0) this.newsList = data.message
    },
  },
}
</script>

<style lang="scss" scoped>
.mui-media-body {
  h3 {
    font-size: 14px;
  }
  .mui-ellipsis {
    color: #26a2ff;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
}
</style>
